Rename "packages" to "integrations" in aspire.config.json with backward compatibility#15633
Rename "packages" to "integrations" in aspire.config.json with backward compatibility#15633
Conversation
Agent-Logs-Url: https://github.com/microsoft/aspire/sessions/991be4bf-31eb-490c-8c07-a1cebce5a01a Co-authored-by: maddymontaquila <12660687+maddymontaquila@users.noreply.github.com>
|
@copilot This needs to be backwards compatible. We need to support both now for reading (both packages and integrations) but write integrations in anything new. |
… write only integrations Agent-Logs-Url: https://github.com/microsoft/aspire/sessions/1581ecd1-3d79-4a46-bdd8-030eea387877 Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com>
Added backward compatibility in a25121c. Now:
|
There was a problem hiding this comment.
Pull request overview
This PR migrates aspire.config.json from the legacy "packages" key to the new "integrations" key while preserving backward-compatible reads, and updates the VS Code extension types/schema plus the playground fixtures accordingly.
Changes:
- Updated
AspireConfigFileJSON serialization to write"integrations"and added a legacy"packages"read path merged post-deserialization. - Updated CLI/extension types and JSON schema to recognize
"integrations"(keeping"packages"for backward compat). - Updated tests and playground
aspire.config.jsonfiles to use"integrations".
Reviewed changes
Copilot reviewed 155 out of 155 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Aspire.Cli/Configuration/AspireConfigFile.cs | Writes "integrations" via [JsonPropertyName], reads legacy "packages" into LegacyPackages and merges on load/save. |
| tests/Aspire.Cli.Tests/Configuration/AspireConfigFileTests.cs | Adds unit tests covering legacy read, new key read, merge behavior, precedence, and save output key. |
| tests/Aspire.Cli.EndToEnd.Tests/ProjectReferenceTests.cs | Updates E2E test mutation logic to write integrations in the config JSON. |
| tests/Aspire.Cli.EndToEnd.Tests/ConfigMigrationTests.cs | Updates E2E CLI command usage from packages to integrations. |
| extension/src/utils/cliTypes.ts | Extends AspireConfigFile TS type with integrations? and keeps packages? as deprecated. |
| extension/schemas/aspire-config.schema.json | Adds "integrations" schema property and retains "packages" with deprecated wording. |
| playground/**/aspire.config.json | Renames "packages" → "integrations" across the playground configs. |
Comments suppressed due to low confidence (1)
extension/schemas/aspire-config.schema.json:207
- The schema describes
packagesas deprecated, but VS Code’s JSON schema support won’t typically surface that as a deprecation warning based on the description alone. If the intent is to guide users away frompackages, consider adding a VS Code-recognized deprecation marker (e.g.,deprecationMessage) to thepackagesproperty while keeping it in the schema for backward compatibility.
"packages": {
"description": "Deprecated: use \"integrations\" instead. Legacy key for integration references, kept for backward compatibility.",
"type": "object",
"additionalProperties": {
"type": "string"
}
},
| /// <summary> | ||
| /// Legacy property for backward compatibility. Reads the <c>"packages"</c> key from | ||
| /// older aspire.config.json files. Merged into <see cref="Packages"/> after deserialization | ||
| /// via <see cref="MergeLegacyPackages"/> (which sets this to <c>null</c>). | ||
| /// Never written back because <c>DefaultIgnoreCondition = WhenWritingNull</c> is configured | ||
| /// on the serializer context. | ||
| /// </summary> | ||
| [JsonPropertyName("packages")] | ||
| public Dictionary<string, string>? LegacyPackages { get; set; } |
There was a problem hiding this comment.
LegacyPackages is intended as a legacy/back-compat input only, but it currently has no [Description]. SettingsSchemaBuilder.BuildConfigFileSchema reflects public properties and uses [Description] for schema/help text, so packages will show up with an empty description in aspire config info --json (and any tooling using that schema). Consider adding a description that explicitly marks it as deprecated/legacy and points users to integrations.
| if (Packages is null) | ||
| { | ||
| Packages = LegacyPackages; | ||
| } |
There was a problem hiding this comment.
MergeLegacyPackages can’t distinguish between "integrations" being absent vs explicitly set to null in JSON (both deserialize to Packages == null). With the current logic, a file containing "integrations": null and legacy "packages": { ... } will end up using the legacy entries, which contradicts the stated precedence of the new key when both are present. If strict precedence is required, consider deserializing via JsonDocument/JsonNode (or a custom converter) so you can detect whether integrations was present and treat explicit null as an override (i.e., do not merge legacy).
| var packages = config["integrations"] as JsonObject ?? new JsonObject(); | ||
| packages["MyIntegration"] = "./MyIntegration/MyIntegration.csproj"; | ||
| config["packages"] = packages; | ||
| config["integrations"] = packages; |
There was a problem hiding this comment.
The local variable is still named packages but it now reads/writes the integrations JSON property. Renaming the variable to integrations (and updating subsequent uses) would avoid confusion when maintaining this test.
Description
Renames the
"packages"JSON key to"integrations"inaspire.config.jsonwhile maintaining full backward compatibility. The system reads both"packages"(legacy) and"integrations"(new) keys, but always writes"integrations"in new or saved files.Changes
AspireConfigFile.cs: Changed[JsonPropertyName("packages")]→[JsonPropertyName("integrations")]on thePackagesproperty. Added aLegacyPackagesproperty with[JsonPropertyName("packages")]for backward-compatible reading, withMergeLegacyPackages()to merge legacy entries intoPackagesafter deserialization. When both keys exist,"integrations"takes precedence.LegacyPackagesis nulled after merge and excluded from serialization viaWhenWritingNull.extension/src/utils/cliTypes.ts: Addedintegrations?toAspireConfigFileinterface; keptpackages?with@deprecatedmarker for backward compatibility.extension/schemas/aspire-config.schema.json: Added"integrations"property and kept"packages"as deprecated for backward compatibility.aspire.config.jsonfiles: Updated key from"packages"to"integrations".ProjectReferenceTests.csandConfigMigrationTests.csto use"integrations". Added 5 new backward-compatibility tests inAspireConfigFileTests.cscovering: reading legacy"packages"key, reading new"integrations"key, merging both keys, precedence when both exist, and verifying only"integrations"is written on save.Before / After:
Checklist
<remarks />and<code />elements on your triple slash comments?aspire.devissue:🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.